<layout name='../Layout/frame_main' />

<body>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12">
			<div >
				<h2>
					产品列表
					<small>共{$count}条数据</small>
				</h2>				<form id="form_search" action="__URL__/allp" method='get' style="border-bottom: 1px solid #EEEEEE;">

<div class="controls" >
<input type="text" value='<?php if(isset($_GET['keywords'])){echo $_GET['keywords'];} ?>' name='keywords' placeholder="关键字" class="span2">
               <button style="margin-bottom: 11px; margin-left: 7px;" type="submit" class="btn btn-primary">搜索<i class="icon-search icon-white"></i>
               </button>
            </div>
</form>
			</div>
			<?php 
			if(count($list)==0)
			{
				echo '<h4>暂时没有数据</h4>';
			}
			else
			{
			?>

			<table class="table table-bordered table-hover table-condensed">
				<thead>
					<tr>
						<th>
							编号
						</th>
						<th>
							名称
						</th>
						<th>
							有效
						</th>
						<th>
							单价/优惠价
						</th>
						<th>
							进价/数量
						</th>
						<th>
							总额
						</th>
						<th>
							大类别
						</th>
						<th>
							查看
						</th>
						<th>
							删除
						</th>

					</tr>
				</thead>
				<tbody>
					<volist name="list" id="vo">
					<tr >
						<td>
							{$vo["pro_id"]}
						</td>
						<td>
							{$vo.pro_name}
						</td>
						<td>
							<label class="checkbox">
								<?php
								if($vo["pro_valid"]==1)
									echo "<input type='checkbox' checked />";
								else 
									echo "<input type='checkbox' />";
								 ?>
						</label>
						</td>
						<td>
							{$vo.pro_selprice}/{$vo.pro_batprice}
						</td>
						<td>
							{$vo.pro_inprice}/{$vo.pro_shuliang}
						</td>
						<td>
							<?php 
							echo intval($vo["pro_shuliang"])
							*intval($vo["pro_inprice"]) 
							;?>
						</td>
						<td>
							{$vo.type_name}
						</td>						
						<td>
						<a class="btn btn-primary see" href='<?php echo U('newp',array_merge($rurl,array('pro_id'=> $vo['pro_id'])));?>' type='button'>查看</a>
						</td>
						<td>
						<a data-toggle="modal" class="btn btn-danger" role="button" href="#myModal{$vo.pro_id}">删除</a>
						</td>
							<form id="form{$vo.pro_id}" action="__URL__/del/pro_id/{$vo.pro_id}" method='get'>
							  <div id="myModal{$vo.pro_id}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
							    <div class="modal-header">
							      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
							      <h3 id="myModalLabel">系统确认</h3>
							    </div>
							    <div class="modal-body">
							      <p>确定要删除编号为【{$vo.pro_id}】，商品名称为【{$vo.pro_name}】 的数据吗？数据删除将导致无法恢复！点击【关闭】退出继续操作，点击【确认删除】进行删除数据操作。</p>
							    </div>
							    <div class="modal-footer">
							      <button class="btn" data-dismiss="modal" aria-hidden="true" id="clbtn{$vo.pro_id}">关闭</button>
							      <button class="btn btn-danger" type="submit">确认删除</button>
							    </div>
							  </div>
							</form>
					</tr>
				</volist>
				</tbody>
			</table>
			<div class="pagination pagination-centered">
				<ul>
					<li>{$page}</li>
				</ul>
			</div>
			<?php } ?>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span12">
		</div>
	</div>
</div>
</body>
<script type="text/javascript">


$(function(){
	$('input:checkbox').click(function(){
		var v=$.trim($(this).parent().parent().parent().children(':first').text());
		var tc=this;
		$.post(
			"__URL__/check/",
			'pdvalue='+v+'&data='+(this.checked?1:0),
			function(data){
				if(data=='OK')
				{
					alert('处理成功！');
				}
				else
				{
					alert('处理失败！');
					tc.checked=!tc.checked;
				}
			});
	});
})
	

</script>
